/*jslint vars: true, forin: true, sloppy: true */
/*global angular, ocDialog, DM, DialogFactory */
var DF = new DialogFactory('oc-alert', '<oc-alert></oc-alert>');
ocDialog.directive('ocAlertOpen', function (ocDialog, $parse) {
	// Fixed template for a alert dialog.

	return {
		restrict: 'A',
		scope: {
			opt: "=ocAlertOpen"
		},
		link: function (scope, element, attr) {
			element.on("click", function () {
				var o = $parse(attr.ocAlertOpen)(scope.$parent);
				ocDialog.alert(angular.extend({
					title: '警告',
					message: '请确认该操作！'
				}, o), DM.queryDialogByElement(element));
			});
		}
	};
});
